package com.onlyyou.cart.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

/**
 * @Author: 小野
 * @Date: 2020/1/11 14:02
 * Swagger 配置类
 */
@Configuration
@EnableSwagger2
public class SwaggerConfig {
    @Bean
    public Docket docketInfo() {
        return new Docket(DocumentationType.SWAGGER_2)
                .pathMapping("/")
                .select()
                .apis(RequestHandlerSelectors.basePackage("com.onlyyou.cart.controller"))
                .build()
                .apiInfo(new ApiInfoBuilder()
                        .title("only you商城购物车服务")
                        .description("服务详细API")
                        .version("2.1").build());
    }
}
